package de.schlinke_marius.application;

import org.acra.ACRA;
import org.acra.ErrorReporter;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;

import android.app.Application;
import de.schlinke_marius.R;
import de.schlinke_marius.acra.CustomEmailIntentSender;
import de.schlinke_marius.data.AppContainer;

@ReportsCrashes(formKey = "", // will not be used
mode = ReportingInteractionMode.NOTIFICATION, resNotifTickerText = R.string.crash_notif_ticker_text, resNotifTitle = R.string.crash_notif_title, resNotifText = R.string.crash_notif_text, resDialogTitle = R.string.crash_dialog_title, resDialogText = R.string.crash_dialog_text, resDialogCommentPrompt = R.string.crash_dialog_comment_prompt)
public class MSComputerApplication extends Application {

	public AppContainer globalData = new AppContainer();
	
	public AppContainer getGlobalData() {
		return globalData;
	}
	
	@Override
	public void onCreate() {
		super.onCreate();
		ACRA.init(this);
		CustomEmailIntentSender sender = new CustomEmailIntentSender(getApplicationContext());
		ErrorReporter.getInstance().setReportSender(sender);
	}
	
	@Override
	public void onTerminate() {
		destroy();
		super.onTerminate();
	}
	
	private void destroy() {
		globalData.clear();
	}

}
